<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/8/2
  Time: 9:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>session作用域</title>
</head>
<body>
<%
    List<String> books = new ArrayList<String>();
    books.add("《三国演义》");
    books.add("《水浒传》");
    books.add("《西游记》");
    books.add("《红楼梦》");
    session.setAttribute("books",books);
    //请求转发
     //request.getRequestDispatcher("/listbooks.jsp").forward(request,response);
    //重定向
    response.sendRedirect("/listbooks.jsp");
    //1. session的作用范围是浏览器窗口，如果不关闭就可以共享sessionId,如果关闭就没有了sessionID,也就找不到session

%>
</body>
</html>
